<template>
  <view class="_heading">
    <text>{{ title }}</text>
  </view>
  <button @tap="onClick(123)">给父组件传事件</button>
</template>

<script>

export default {
  name: "Heading",
  props: {
    title: {
      type: String,
      default: "默认的标题"
    },
    // [] {}
    handleClick: {
      type: Function,
      default: () => {}
    }
  },
  setup(props) {
    // 子 -> 父 传值
    const onClick = (data) => {
      props.handleClick(data)
    }

    return {
      onClick
    }
  }
}
</script>

<style lang="scss">
._heading {
  font-size: 50px;
  color: #ff6700;
}
</style>
